<template>
    <div class="the-footer">
        <p>
            <span class="footer" v-html="footer"></span>
        </p>
        <p>
            Copyright ©2023 By
            <span v-html="copyright"></span>
        </p>
        <p>
            <img
                src="../assets/img/icon-filing.png"
                style="
                    width: 15px;
                    height: 15px;
                    margin-top: -4px;
                    margin-left: 4px;
                "
            />
            <span v-html="filing"></span>
        </p>
    </div>
</template>
<script>
import { getConfig, getConfigList } from "../api/index";

export default {
    name: "the-footer",
    data() {
        return {
            copyright:
                '<a href="https://github.com/KuhnXIE" style="text-decoration: none;" target="_blank">KuhnXIE</a>',
            footer: '<span><a  style="text-decoration: none;" href="#">关于</a></span><span>|</span><span><a  style="text-decoration: none;" href="#">帮助</a></span><span>|</span><span><a  style="text-decoration: none;" href="#">条款</a></span><span>|</span><span><a  style="text-decoration: none;" href="#">反馈</a></span>',
            filing: '<a href="https://beian.miit.gov.cn/" style="text-decoration: none;" target="_blank">湘ICP备202312146666号-1</a>',
        };
    },
    mounted() {
        // 初始化配置信息
        this.initConfig();
    },

    methods: {
        initConfig() {
            getConfig("COPYRIGHT")
                .then((res) => {
                    let _data = res.data;
                    this.copyright = _data.value;
                })
                .catch((err) => {
                    console.log(err);
                });
            getConfigList(["WEBSITE_FOOTER", "FILING_ICP"])
                .then((res) => {
                    let _data = res.data;
                    this.footer = _data.WEBSITE_FOOTER;
                    this.filing = _data.FILING_ICP;
                })
                .catch((err) => {
                    console.log(err);
                });
            getConfig("WEBSITE_FOOTER")
                .then((res) => {
                    let _data = res.data;
                    this.footer = _data.value;
                })
                .catch((err) => {
                    console.log(err);
                });
        },
    },
};
</script>
<style lang="scss" scoped>
@use "../assets/css/the-footer.scss";
</style>
